#include<iostream>
#include<unistd.h>
using namespace std;
int main()
{
  pid_t id = fork();
   
  if(id == 0)
  {
    for (int i = 0;i < 100000;i++)
    {
      sleep(1);
      cout<<"child:"<<getpid()<<"parent:"<<getppid()<<endl;
    }
  }
  else
  {
    for(int i = 0;i < 5;i++) 
    {
      sleep(1);
      cout<<"父进程执行中"<<endl;
    }
  }
  return 0;
}

